package com.easyfun.healthmagicbox.comm.json;

import org.json.JSONException;
import org.json.JSONObject;

import com.easyfun.healthmagicbox.pojo.PersonQuestion;
import com.easyfun.healthmagicbox.pojo.User;

public class PersonQuestionsJsonWrapper<T extends JsonWrapper,E> 
			extends AbstractJsonWrapper<T, PersonQuestion>{
	/*PersonQuestion mpp;*/
	
	public PersonQuestionsJsonWrapper(PersonQuestion pp)
	{
		super(pp);
		this.mpp = pp;
	}
 
	public PersonQuestionsJsonWrapper()
	{
		
	}
 
    public void deserializeFromObj(JSONObject obj) throws JSONException {
		mpp = new PersonQuestion();
		
		if (obj.isNull("id"))
    	{
    		mpp.setSyncid(Integer.valueOf(0));
    	}else {
    		mpp.setSyncid(obj.getInt("id"));
    	}
    	mpp.setDoctorID(obj.getString("doctorID"));
    	mpp.setPersonID(obj.getString("personID"));
    	mpp.setQuestion(obj.getString("question"));
    	mpp.setQuestionTime(obj.getString("questionTime"));
    }
 
 
    public JSONObject serializeToObj() throws JSONException {
        JSONObject serializedObj = new JSONObject();
        serializedObj.put("clientID", mpp.getId());
        serializedObj.put("doctorID", mpp.getDoctorID());
        serializedObj.put("personID", mpp.getPersonID());
        serializedObj.put("question", mpp.getQuestion());
        serializedObj.put("questionTime", mpp.getQuestionTime());
 
        return serializedObj;
    }
    
}
